const moduleData = require("./module.json");
const bodyParser = require("body-parser");

// 创建 application/json 解析
var jsonParser = bodyParser.json();

//var fs = require("fs");

const navMock = function(app) {
    app.get("/mock/am/v1/module/tree", function(req, res) {
        res.json(moduleData);
    });

    //新增
    app.post("/mock/am/v1/navigation", jsonParser, function(req, res) {
        if (!req.body) return res.sendStatus(400);
        res.send(req.body);
    });
};

module.exports = navMock;
